﻿using BizUnit;
using System.Diagnostics;
using BTS.Testing.TraceMonitor.BizUnit4.TestSteps.TraceControlAgent;

namespace BTS.Testing.TraceMonitor.BizUnit4.TestSteps
{
    /// <summary>
    /// Stops the realtime event trace
    /// </summary>
    public class StopRealtimeEventTrace : BizUnit.Xaml.TestStepBase
    {
        public const string TraceMonitorProcessName = "BTS.Testing.TraceMonitor";
        

        public override void Execute(Context context)
        {
            var serviceAgent = new TraceControlServiceClient();
            serviceAgent.Stop();

            var processes = Process.GetProcessesByName(TraceMonitorProcessName);
            foreach (var process in processes)
            {
                process.Kill();
            }
        }

        public override void Validate(Context context)
        {
            
        }
    }
}
